#include "MOConnectionSelector.h"
#include "resources.h"
#include "../MeasurementObject.h"
#include "../ConfigurationManager.h"

#include <QGroupBox>

namespace ui {

MOConnectionSelector::MOConnectionSelector(QWidget *_parent, core::SharedMOPtr _measBase): BaseUI() {
    parent = _parent;
    measBase = _measBase;
}

bool MOConnectionSelector::setup() {
    if(!BaseUI::setup(UI_MO_CONNECTIONS))
        return false;

    formWidget->setWindowFlags(Qt::Dialog);

    QGroupBox *grpBox = formWidget->findChild<QGroupBox*>("groupBox");
    grpBox->setTitle(QString::fromStdWString(measBase->getMOLink()->name));

    lstMOs          = formWidget->findChild<QListWidget*>("lstMOs");
    lstConnections  = formWidget->findChild<QListWidget*>("lstConnections");

    const std::list<core::MeasConnection*> &connections =
            core::ConfigurationManager::getInstance().getMeasConnHandler().getConnections();

    return true;
}

}
